<script setup>
import { storeToRefs } from 'pinia'
import useStore from '../store'

const { todos, filters } = useStore()
const { isShowFooter, leftCount, isShowClear } = storeToRefs(todos)
</script>

<template>
  <footer class="footer" v-if="isShowFooter">
    <span class="todo-count"
      ><strong>{{ leftCount }}</strong> item left</span
    >
    <ul class="filters">
      <li
        v-for="item in filters.filterList"
        :key="item"
        @click="filters.changeActive(item)"
      >
        <a :class="{ selected: filters.active === item }" href="#/">{{
          item
        }}</a>
      </li>
    </ul>
    <button class="clear-completed" v-if="isShowClear" @click="todos.clearDone">
      Clear completed
    </button>
  </footer>
</template>

<style lang="less" scoped></style>
